/**
 * @author: Miss.杨
 * @date: 2025年3月15日 17:02:04
 * @description: 
 */
package com.sheepone.monitor.test;

import com.sheepone.monitor.audit.AuditMonitorClientChannelInitializer;
import com.sheepone.monitor.client.AbstractMonitorClient;
import com.sheepone.monitor.client.config.MonitorClientConfig;
import com.sheepone.webdev.config.WebdevConfigManager;
import com.sheepone.webdev.log.WebDevLogger;

/**
 * @author: Miss.杨
 * @date: 2025年3月15日 17:02:04
 * @description:
 */
public class Client extends AbstractMonitorClient<MonitorClientConfig, AuditMonitorClientChannelInitializer> {
    public Client() {
        super(configParse());
    }

    private static WebDevLogger logger = WebDevLogger.getLogger(Client.class);

    protected static MonitorClientConfig configParse() {
        WebdevConfigManager.init();
        MonitorClientConfig config = null;
        if (WebdevConfigManager.get("monitor.client") == null) {
            logger.info("No configuration found for monitor.client; default settings will be applied.");
            config = new MonitorClientConfig();
        } else {
            config = WebdevConfigManager.fill(MonitorClientConfig.class);
        }
        return config;
    }

    @Override
    protected AuditMonitorClientChannelInitializer channelInitializer() {
        return new AuditMonitorClientChannelInitializer();
    }

    @Override
    protected void afterInitd() {
        this.runner.addListener(new TestListener());
    }

}
